import {
	base_api
} from "../config/config.js"

class HTTP {
	request({
		url,
		method = "GET",
		data = {}
	}) {
		return new Promise((resolve, resject) => {
			this._request(resolve, resject, url, method, data)
		})
	}
	_request(resolve, resject, url, method = "GET", data = {}) {
		uni.request({
			url: base_api + url,
			method: method,
			data: data,
			success: (res) => {
				resolve(res.data.data)
			},
			fail: (error) => {
				resject(error)
			}
		})
	}

}
export {
	HTTP
}
